package defpackage; import android.app.Activity; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.foreigntemplate.bean.TemplateSendToMailResult; import cn.wps.moffice_eng.R; import com.google.gson.reflect.TypeToken; /* renamed from: fbx reason: default package */ public final class fbx { public CheckBox fAY; public TextView fAZ; public View fBa; public View fBb; private boolean fBc; public Activity mActivity; /* renamed from: fbx$a */ public class a extends fcv<Void, Void, String> { private String fBf; private String fBg; private String fBh; public a(String str, String str2, String str3) { this.fBf = str; this.fBg = str2; this.fBh = str3; } /* JADX WARNING: Removed duplicated region for block: B:10:0x0077 */ /* JADX WARNING: Removed duplicated region for block: B:20:0x009e */ private String atg() { boolean z; String str; String string = OfficeApp.arx().getString(R.string.public_network_error); try { fbv btv = fbv.btv(); OfficeApp arx = OfficeApp.arx(); String str2 = this.fBf; String str3 = this.fBg; String str4 = this.fBh; hwe hwe = new hwe(); hwe.dk("uid", str2); hwe.dk("tid", str3); hwe.dk(NotificationCompat.CATEGORY_EMAIL, str4); fbv.a(arx, hwe, false); TemplateSendToMailResult templateSendToMailResult = (TemplateSendToMailResult) fbv.a(new log(arx).Lr(0).HX("http://api.docer.4wps.net/template/send2mail").b(new TypeToken<TemplateSendToMailResult>() { /* class defpackage.fbv.AnonymousClass5 */ }.getType()).u(hwe.cmr())).loadInBackground(); if (templateSendToMailResult != null) { if (templateSendToMailResult.isOk()) { z = true; try { string = OfficeApp.arx().getString(R.string.public_send_template_success); } catch (Throwable th) { } } else if (templateSendToMailResult.isTooLarge()) { string = OfficeApp.arx().getString(R.string.public_send_template_size_out_of_limit); z = false; } else if (!TextUtils.isEmpty(templateSendToMailResult.data)) { str = templateSendToMailResult.data; string = str; z = false; } dwp.lV(!z ? "public_template_sendmail_success" : "public_template_sendmail_fail"); return string; } str = string; string = str; z = false; } catch (Throwable th2) { z = false; } dwp.lV(!z ? "public_template_sendmail_success" : "public_template_sendmail_fail"); return string; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */ /* access modifiers changed from: protected */ @Override // defpackage.fcv public final /* synthetic */ String doInBackground(Void[] voidArr) { return atg(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ /* access modifiers changed from: protected */ @Override // defpackage.fcv public final /* synthetic */ void onPostExecute(String str) { String str2 = str; if (!TextUtils.isEmpty(str2)) { lvg.a(OfficeApp.arx(), str2, 0); } } } public static String btw() { return jaa.bH(OfficeApp.arx(), "config_send_template_mail").getString("address", null); } public final void kn(boolean z) { if (this.mActivity != null) { String btw = btw(); if (z) { if (TextUtils.isEmpty(btw)) { dwp.lV("public_template_addmailhint_show"); return; } this.fBc = true; dwp.lV("public_template_sendmailhint_show"); } else if (!this.fBc && !TextUtils.isEmpty(btw)) { this.fBc = true; dwp.lV("public_template_sendmailhint_show"); } } } public void updateViewState() { String btw = btw(); if (TextUtils.isEmpty(btw)) { this.fAZ.setText(R.string.public_send_template_to_email); this.fAY.setVisibility(8); this.fBb.setVisibility(0); this.fBa.setVisibility(8); return; } this.fAZ.setText(String.format(this.mActivity.getString(R.string.public_send_template_to), btw)); this.fAY.setVisibility(0); this.fBb.setVisibility(8); this.fBa.setVisibility(0); } }